home *** CD-ROM | disk | FTP | other *** search
/ Champak 146 / (Vol 146) Jan 07 2012.iso / Games / scuba.swf / scripts / frame_18 / PlaceObject2_111_421 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2012-01-07  |  1KB  |  39 lines

  1. onClipEvent(enterFrame){
  2.    if(status == "active" && this._x >= _root.RIGHT_BOUND)
  3.    {
  4.       if(_root.coral.hitTest(this._x,this._y,true) == true)
  5.       {
  6.          vSideOfImpact = "undetermined";
  7.          vPixelCounter = Number(1);
  8.          while(vSideOfImpact == "undetermined")
  9.          {
  10.             if(_root.coral.hitTest(this._x,Number(this._y + Number(vPixelCounter)),true) == false && Number(this._y + Number(vPixelCounter)) < _root.BOTTOM_BOUND)
  11.             {
  12.                vSideOfImpact = "top";
  13.                vPixelOffset = vPixelCounter + Number(this._height);
  14.             }
  15.             else if(_root.coral.hitTest(this._x,Number(this._y - Number(vPixelCounter)),true) == false && _root.TOP_BOUND < Number(this._y - Number(vPixelCounter)))
  16.             {
  17.                vSideOfImpact = "bottom";
  18.                vPixelOffset = vPixelCounter + Number(this._height);
  19.             }
  20.             vPixelCounter++;
  21.          }
  22.          if(vSideOfImpact == "top")
  23.          {
  24.             setProperty(this, _Y, Number(this._y + Number(vPixelOffset)));
  25.          }
  26.          else if(vSideOfImpact == "bottom")
  27.          {
  28.             setProperty(this, _Y, Number(this._y - Number(vPixelOffset)));
  29.          }
  30.       }
  31.    }
  32.    else if(status == "active" && this._x < _root.RIGHT_BOUND && _root.recruit.diver.hitTest(this._x,this._y,false) == true)
  33.    {
  34.       status = "neutralized";
  35.       this.gotoAndPlay("neutralized");
  36.       _root.fnScorePoints();
  37.    }
  38. }
  39.